Join order restrictions

ABSTRACT

A query that is submitted to a database is analyzed so as to determine a join order restriction. The join order restriction is associated with a join between two tables of a plurality of tables of the database that participate in the query. The join order restriction constrains its associated join to be executed prior to another join of the query. At least one join plan is generated, the join plan being constrained by the join order restriction. Different join plans include different join orders. A join plan is selected from among the join plans for execution of the query.

CROSS REFERENCE TO RELATED APPLICATIONS

The present invention claims the priority benefit of U.S. provisionalpatent application No. 61/485,812 filed on May 13, 2011, which isincorporated in its entirety herein by reference.

BACKGROUND

A database system may include data that is organized in various tables.Each table typically includes one or more rows (also known as tuples orrecords) that include a set of related data (e.g. related to a singleentity). The data for each row may be arranged in a series of columns orfields, wherein each column includes a particular type of data (e.g.type of characteristic of an entity).

A table may contain data that is related to data in another table. Forexample, in a first table each row may represent an individual item(e.g. person, object, or event). In a second table, each row mayrepresent a classification group (e.g. organization to which personbelongs, places where objects may be located, time periods where eventsmay occur). Tables of a database may be related to one another. Forexample, a column of the first table may associate each individual itemrepresented there by a reference to one of the classification groups inthe second table.

A query to the database may retrieve data that is related in a definedmanner from different tables of the database. For example, a query maybe expressed in SQL (Structured Query Language) or in another form. Aquery may be represented as a joining of the tables that are addressedby the query. For example, two tables may be joined by selecting a rowof each table that satisfies a criterion (e.g. a particular column valuein the row) to form a row in a joined table. In the above example,joining the first and second tables may result, e.g., in a joined tablein which a row includes a characteristic of an item from the first tabletogether with a characteristic of a group with which that item isassociated. In the case of a complex join operation (e.g. where severaltables are joined in a sequence of individual join operations) the joinoperation, and thus the query, may be optimized by modifying an order inwhich the various individual join operations are executed.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1A shows a join tree that represents a query.

FIG. 1B shows a join graph that is derived from query that isrepresented by the join tree of FIG. 1A.

FIG. 2A shows a join tree that represents a query to which an example ofa join order restriction is applicable.

FIG. 2B shows a join graph with a join order restriction that is derivedfrom a query that is represented by the join tree of FIG. 2A.

FIG. 3 is a schematic diagram of a system for application of join orderrestrictions in query optimization.

FIG. 4 is a flowchart depicting an example of a method for queryoptimization using join order restrictions.

FIG. 5 is a join graph representing an example of a query with multiplejoin order restrictions.

FIG. 6 is a join graph showing examples of alternative join rankingsbased on a single join graph that includes a join order restriction.

DETAILED DESCRIPTION

In accordance with an example of application of join order restrictions,a database includes a query optimizer for optimizing a query that issubmitted (the input query) to a database before the query is run by thequery execution engine. For example, a query may be submitted to thedatabase in a form that is understandable to a user or programmer thatsubmits the query. The query as submitted may be representable as aseries of joins between the tables of the database that participate inthe query. In optimizing a query, a query optimizer may change the orderof joins between the tables and evaluate an efficiency of the query foreach join order. For example, a cost function that is indicative ofefficiency may be calculated for each join order that the optimizerevaluates. Comparison of the calculated cost functions for eachevaluated join order may determine which of the join orders result inincreased efficiency (or optimum efficiency) in execution of the query.

However, in order to reliably obtain the desired result of the query,any evaluated join order should not modify a result of the query. Thus,an example of join order restrictions may be applied by the queryoptimizer so as to restrict evaluated join orders to those join ordersthat do not affect the result of the query.

For example, a query may be expressible as a series of joins thatincludes only inner joins. An inner join is based on a join-predicate(e.g. in which a row is selected from a first table to be joined with arow from a second table when a particular column value of the row fromthe first table is equal to a particular column value of the row fromthe second table). Inner joins may be freely reordered (commuted andre-associated) without affecting the results of the query. Thus, in thisexample, join order restrictions would not be required and an optimizermay freely reorder the joins to obtain an optimized query.

Consider a simple example of a query to a database that includes threetables: table A, table B, and table C. Each of tables A, B, and Cincludes a single row and two columns. The columns of table A arelabeled a and b, the contents of each column of its single row having avalue of 1. Similarly, columns of table B are labeled x and y withcontents of each column of the single row having a value of 2.Similarly, columns of table C are labeled p and q with contents of eachcolumn of the single row having a value of 3. Tables A, B, and C may berepresented as follows:

A a b 1 1

B x y 2 2

C p q 3 3

A freely re-orderable query that is submitted to this database may beexpressed as:

select a, x, p from (A join B on A.a=B.x) join C on B.y=C.p.

This freely re-orderable query includes only inner joins.

The joins of a query as submitted may be visualized as a join tree. Ajoin tree unambiguously represents the join evaluation order of thequery. For example, the join tree may be derived from the syntacticstructure of an SQL query or from a transformation of another join tree.In the join tree, each leaf represents a table that participates in thequery and inner nodes represent joins. Each join node is connected bytwo incoming edges (below the node) to the left input and right input tothe join. The inputs may be tables (leaves) or other joins (nodes). Thestructure of the tree indicates that an input to a join node is to beprocessed before the join that is indicated by that join node.

FIG. 1A shows a join tree that represents a freely re-orderable query.Join tree 10 corresponds to the freely re-orderable query of the aboveexample.

Join tree 10 includes leaves 12A, 12B, and 12C corresponding to tablesA, B, and C of the above example, respectively. Node 14 a represents aninner join between tables A and B. Node 14 b represents an inner joinbetween the inner join represented by node 14 a, and table C. The jointree represents the query as submitted.

An optimizer is capable of reordering joins and of evaluating thereordered query in light of an optimization criterion (e.g. asdetermined by a cost function). A reordering of the joins that yields anoptimal query as determined by the optimization criterion may beselected for execution. For the purpose of use by the optimizer, thejoins may be organized in a form that may be represented by a joingraph. In a join graph, a node may represent a table, and an edgeconnecting two nodes represents a join between the objects that arerepresented by the nodes. In the case that the edge represents an innerjoin, no directionality is indicated on the edge.

FIG. 1B shows a join graph that is derived from a query that isrepresented by the join tree of FIG. 1A. In join graph 20, nodes 13A,13B, and 13C correspond to leaves 12A, 12B, and 12C, representing tablesA, B, and C, respectively. Edge 17 a represents an inner join betweentable A and table B. Edge 17 b represents an inner join between table Band table C.

The number above each of edges 17 a and 17 b represents a priority,herein referred to as a rank, that is assigned to each of thecorresponding joins (where a numerically low rank implies highpriority). Since both of edges 17 a and 17 b are assigned a rank of 1,no priority among the corresponding joins is indicated. Thus, tables Aand B may be joined before joining the result of the join with table C,or tables B and C may be joined before joining the result of the joinwith table A. This is a consequence of the associative property of innerjoins.

Another example of a query may be expressible as a series of joins whereat least one of the joins is an outer join (e.g. in which a row isselected from one of the tables whether or not a join-predicate or joincriterion is satisfied). A series of joins that includes an outer joinmay be neither commutative nor associative. In this case, unrestrictedreordering of joins in a series of joins that includes outer joins couldresult in nonequivalent joined tables, affecting the result of thequery. In this example, therefore, a join order restriction may beapplied by the optimizer so as to restrict evaluation to those joinorders that would yield that same result as the query as submitted.

An example of a non-reorderable query that is submitted to thisdatabase, using the tables A, B, and C, and their columns as describedin the previous example, may be expressed as:

select a, x, p from (A left join B on A.a=B.x) join C on B.y=C.p.

The left join is performed first, followed by the inner join, andresults in zero rows:

a x p (0 rows)

A rearrangement (re-association) of the query may be expressed as:

select a, x, p from A left join (B join C on B.y=C.p) on A.a=B.x.

Since the inner join is performed first and is followed by the leftjoin, a single row results:

a x p 1

Thus, in such a case of a non-reorderable query, reordering the joinsresults in modification of the results. Use of join order restrictionsby a query optimizer would prevent such a reordering.

FIG. 2A shows a join tree that represents a non-reorderable query towhich an example of a join order restrictions is applicable. Join tree11 corresponds to the non-reorderable query as submitted in the aboveexample.

Join tree 11 includes leaves 12A, 12B, and 12C corresponding to tablesA, B, and C, respectively. Node 15 a represents a table A left joined totable B. Node 15 b represents the result of the left join that isrepresented by node 15 a, joined by an inner join to table C.

FIG. 2B shows a join graph with a join order restriction that is derivedfrom the non-reorderable query that is represented by the join tree ofFIG. 2A.

In join graph 21, nodes 13A, 13B, and 13C correspond to leaves 12A, 12B,and 12C, representing tables A, B, and C, respectively. Directed edge 16a from node 13A to node 13B represents a left join of table A to tableB. Join graph 21 includes join order restriction node 18, connected byundirected edge 16 b to node 13C. Join order restriction node 18represents the left join of table A to table B. Undirected edge 16 bindicates that the result of the left join is joined by an inner join totable C. Thus, join graph 21 represents an organization of the query inwhich the left join of table A to table B is constrained to be executedprior to the inner join with table C. This join order is indicated bythe rank of 1 that is assigned to directed edge 16 a, and the rank of 2that is assigned to undirected edge 16 b. The ranking is interpreted bythe query optimizer as constraining the join order from any join orderthat would yield a result that is different from that of the query assubmitted.

A query optimizer may be configured to generate and evaluate variousjoin orders in order to identify an optimum join order. A submittedquery may be interpreted to identify join order restrictions. Forexample, a submitted query may be examined in a recursive manner. Therecursive examination may be visualized as traversing a join tree thatrepresents the submitted query. Each node of the join tree may beexamined in light of a set of conditions. A node may be incorporatedinto a join graph representation as a join order restriction ifpredetermined conditions of the set are satisfied.

A query optimizer may be configured with a join ranker. A join rankermay assign a priority or rank (e.g. where a numerically low rank implieshigher priority) to each join of a join graph that is derived from ajoin tree. If one join is assigned a numerically lower rank or higherpriority than another join, then the join with the lower rank must beperformed prior to the join with the higher rank. Equal ranking of joinsof a join graph indicates that each equally ranked join may be performedprior to another equally ranked join with equivalent results. A joinranker for use with join order restrictions assigns a rank to a join inlight of any generated join order restrictions. Thus, a join that isindicated by a join order restriction is performed prior to a join of ajoin order restriction node to another node (e.g. that represents atable or another join order restriction).

A query optimizer may include a join generator. The join generator maygenerate a join plan that corresponds to each allowed order of joins, orto each of a subset of such join orders, that result from a join graph.The join plans include join orders in which the joins are ordered inaccordance with the ranking that is assigned by the join ranker to eachjoin of the join graph. If two or more joins are assigned equal ranks bythe join ranker, then the join generator may generate separate joinplans in which the equally ranked joins are performed in differentorders.

Each join plan that is generated by the join generator may be evaluatedin light of an optimization criterion, such as a cost function. Forexample, the optimization criterion may be based at least partially onfactors such as organization (e.g. replication, segmentation, indexing)of the tables that participate in the query. Evaluation of the joinplans may indicate that the optimization criterion for one of the joinplans is optimal (e.g. lowest cost). The query that corresponds to thatjoin plan may be selected by the query optimizer for execution.

FIG. 3 is a schematic diagram of a system for application of join orderrestrictions in query optimization.

Query optimization system 30 includes a processor 32. For example,processor 32 may include one or more processing units, e.g. of one ormore computers. Processor 32 may be configured to operate in accordancewith programmed instructions stored in memory 48. Processor 32 may becapable of executing an application for query optimization on the basisof join order restrictions.

Processor 32 may communicate with memory 48. Memory 48 may include oneor more volatile or nonvolatile memory devices. Memory 48 may beutilized to store, for example, programmed instructions for operation ofprocessor 32, data or parameters for use by processor 32 duringoperation, or results of operation of processor 32

Processor 32 may communicate with data storage device 34. Data storagedevice 34 may include one or more fixed or removable nonvolatile datastorage devices. For example, data storage device 34 may include anon-transitory computer readable medium for storing program instructionsfor operation of processor 32. Data storage device 34 may be utilized tostore data or parameters for use by processor 32 during operation, orresults of operation of processor 32.

For example, data storage device 34 may be utilized to store all or partof database 36. Database 36 may include one or more data tables 38. Datatables 38 may include tables that are replicated such that multiplecopies are stored on different data storage devices (all of which may beconsidered to be included in data storage device 34). Data tables 38 mayinclude segmented tables in which different segments of a data table 38are stored on different data storage devices.

Programmed instructions stored on data storage device 34 may includeinstructions for a query optimizer 40 that includes a restricted joingraph generator module 42 for generating a re-orderable representationof a submitted query that may be visualized as a join graph and that mayincorporate a join order restriction, a join ranker module 44 forassigning a rank to each join of the query at least partially on thebasis of generated join order restrictions, or a join order generatormodule 46 for generating a join plan that is constrained by the rankthat is assigned to each join. It is noted that data storage device 34may be remote from processor 32. In such cases data storage device 34may be a storage device of a remote server storing restricted join graphgenerator module 42, join ranker module 44, or join order generatormodule 46 in the form of an installation package or packages that can bedownloaded and installed for execution by processor 32.

In operation, processor 32 may execute a method for query optimizationon the basis of join order restrictions.

FIG. 4 is a flowchart depicting an example of a method for queryoptimization using join order restrictions.

Query optimization method 100 may be executed by a processor of a systemfor query optimization using join order restrictions. Query optimizationmethod 100 may be executed by a query optimization application. Forexample, query optimization method 100 may be executed whenever a queryis submitted to a database that the query optimization application isconfigured to be associated with.

It should be understood with respect to the flowchart that the divisionof the illustrated method into discrete operations represented by blocksof the flowchart has been selected for convenience and clarity only.Alternative division of the illustrated method into discrete operationsmay be possible with equivalent results. Such alternative division ofthe illustrated method into discrete operations should be understood asrepresenting other examples of the illustrated method.

Similarly, it should be understood that, unless indicated otherwise, theillustrated order of execution of the operations represented by blocksof the flowchart has been selected for convenience and clarity only.Operations of the illustrated method may be executed in an alternativeorder, or concurrently, with equivalent results. Such reordering ofoperations of the illustrated method should be understood asrepresenting other examples of the illustrated method.

Query optimization method 100 may be executed when a query is submittedto a database (block 110). The query as submitted implicitly defines anorder of joins between those tables of the database that participate inthe query. The order of join of the query as submitted is representableby a join tree. Different projections of tables of the database may beconsidered separately.

The query as submitted is analyzed by a restricted join graph generatorin order to generate any join order restrictions and to create are-orderable (join graph) representation of the query (block 120).

For example, generation of a join order restriction by the restrictedjoin graph generator may include examining syntactical relationshipsamong the joins of the query. This may be visualized as a recursivetraverse of the join tree that represents the query as submitted. Listsof relations for each join of the query (nodes of the join tree) may begenerated. Such relation lists may include a list of all tables (leaves)below (that are joined by) that join, a list of all tables below thatjoin that are joined by an inner join, and whether or not that join(node) may provide a null value (e.g. when a join criterion is notsatisfied) in an outer join that is represented by another nodeimmediately above the node in question (e.g. the node in question is onthe left side of a right join, or is on the right side of a left join).

A function of a restricted join graph generator may return a list ofnodes of a join graph to which join order restrictions are to be added.

A join graph representation of the query (to be understood as includingany equivalent or similar representation of the query) that is generatedby the restricted join graph generator incorporates any generated joinorder restrictions.

For example, the join graph representation may include join informationfor every join in the query. Join information regarding a join may lista minimum number of tables and joins that are required to be executedprior to executing the join to which the join information applies. Itmay also list those tables that are syntactically below the join. Priorexamples showed how the minimum tables are used to create join orderrestrictions to maintain desired results. As another example, a joingraph representation may use the tables that are syntactically below ajoin. This would force the join order to remain as was implicitlydefined by the input query.

In a join graph that corresponds to the query, generated join orderrestrictions may be represented as a particular type of node in adisconnected join graph. The join order restriction node is joined by anedge to another node, indicating that the join that is indicated by thejoin order restriction node is to be joined to another table or joinresult. The join order restriction node includes an indication that thejoin that the join order restriction node represents is to be executedprior to the join that is indicated by the edge.

A join ranker assigns a rank (priority) to each join of the query, theranking incorporating any generated join order restrictions (block 130).The ranking indicates which joins, if any, are to be executed prior toother joins such that the results of the query are not affected. Thejoin ranker assigns ranks in such a manner as to ensure that any jointhat is included under a join order restriction is not assigned apriority below (or numerical rank greater than) that assigned to anyjoins of another node to the join order restriction node.

A join order generator generates one or more join plans that are basedon the ranking of the various joins of the query (block 130). Where twoor more joins are assigned equivalent ranks, two or more join plans maybe generated.

Examples of assigning ranks to joins were discussed previously inconnection with FIG. 1B and FIG. 2B. The numbers that indicated theranks indicate an order in which the joins are performed.

In the example of FIG. 1B, both the join represented by edge 17 a andthe join represented by edge 17 b have been assigned equal ranks of 1.Thus, the order of the indicated joins does not affect the results ofthe query. Thus, a join order generator may generate one join plan inwhich the join that is represented by edge 17 a (of table A to table B)is performed prior to the join that is represented by edge 17 b (of theresult of the join of edge 17 a to table C). The join order generatormay similarly generate another join plan in which the join that isrepresented by edge 17 b (of table B to table C) is performed prior tothe join that is represented by edge 17 a (of the result of the join ofedge 17 b to table A).

On the other hand, in the example of FIG. 2B, the join represented byedge 16 a is assigned a rank of 1. Join order restriction node 18, inturn, represents the join that is represented by edge 16 a in the jointhat is represented by edge 16 b. The join that is represented by edge16 b has been assigned a rank of 2. The ranking of edges 16 a and 16 bindicates that in order to avoid affecting results of the representedquery, the join that is represented by edge 16 a is executed beforeexecuting the join that is represented by edge 16 b. Thus, a join ordergenerator is constrained to generate a single join plan in which thejoin that is represented by edge 16 a (of table A to table B) isperformed prior to the join that is represented by edge 17 b (of theresult of the join of edge 16 a to table C).

FIG. 5 is a join graph representing an example of a query with multiplejoin order restrictions. Join graph 50 represents a query that issubject to multiple join order restrictions. In the example shown, nodes22A through 22E represent tables A through E, respectively. As shown, arestricted join graph generator has determined that the join that isrepresented by edge 24 a is to be executed prior to the joins that arerepresented by edges 24 b and 24 c. This priority is indicated by joinorder restriction node 26 a. However, there is no priority between thejoins that are represented by edges 24 b and 24 c. Thus, a join rankerhas assigned a rank of 1 to the join that is represented by edge 24 a,and a rank of 2 to each of the joins that are represented by edges 24 band 24 c.

Similarly, the joins that are represented by edges 24 b and 24 c are tobe performed prior to the join that is represented by edge 24 d. Thispriority is indicated by join order restriction node 26 b. The joinranker has thus assigned a rank of 3 to the join that is represented byedge 24 d.

A join order generator may generate one join plan in which the join thatis represented by edge 24 b (of the join result that is represented byjoin order restriction node 26 a to table C) is performed prior to thejoin that is represented by edge 24 c (of the result of the join of edge24 b to table D). The join order generator may similarly generateanother join plan in which in which the join that is represented by edge24 c (of the join result that is represented by join order restrictionnode 26 a to table D) is performed prior to the join that is representedby edge 24 b (of the result of the join of edge 24 c to table C). Theorders of all other joins are constrained by the ranking.

FIG. 6 is a join graph showing examples of alternative join rankingsbased on a single join graph that includes a join order restriction. Inthe example shown, nodes 22A through 22D represent tables A through D,respectively. A restricted join graph generator has determined that thejoin that is represented by edge 25 a is to be executed prior to thejoins that are represented by edges 25 b and 25 c. The priority isindicated by join order restriction node 27. A join ranker has thereforeassigned a rank of 1 to the join that is represented by edge 25 a, and arank of 2 to the join that is represented by edge 25 b.

However, no priority is determined between the joins that arerepresented by edges 25 a and 25 c, nor between the joins that arerepresented by edges 25 b and 25 c. Therefore, a join ranker may assignalternative rankings to the join that is represented by edge 25 c. Thesealternative rankings are illustrated by alternative join graphs 52 and52′.

In first alternative join graph 52, the join that is the join that isrepresented by edge 25 c has been assigned a rank of 2, equal to therank that was assigned to the join that is represented by edge 25 b. Inalternative join graph 21′, the join that is the join that isrepresented by edge 25 c has been assigned a rank of 1, equal to therank that was assigned to the join that is represented by edge 25 a.

As a result the ranking in first alternative join graph 52, a join ordergenerator may generate one join plan in which the join that isrepresented by edge 25 b (of the join result that is represented by joinorder restriction node 27 to table C) is performed prior to the jointhat is represented by edge 25 c (of the result of the join of edge 25 bto table D). The join order generator may similarly generate anotherjoin plan in which in which the join that is represented by edge 25 c(of table C to table D) is performed prior to the join that isrepresented by edge 25 b (of the result of the join of edge 25 c to thejoin result that is represented by join order restriction node 27). Bothof these joins are constrained by the ranking to be executed after thejoin that is represented by edge 25 a.

As a result the ranking indicated in second alternative join graph 52′,a join order generator may generate one join plan in which the join thatis represented by edge 25 a (of table A to table B) is performed priorto the join that is represented by edge 25 c (of table C to table D).The join order generator may similarly generate another join plan inwhich in which the join that is represented by edge 25 c (of table C totable D) is performed prior to the join that is represented by edge 25 a(of table A to table B). Both of these joins are constrained by theranking to be executed prior to the join that is represented by edge 25b (of the results of all of the joins represented by edges 25 a and 25 cto the join result that is represented by join order restriction node27).

Each generated join plan may be evaluated, e.g. in light of anoptimization criterion (block 150). For example an optimizationcriterion may be based on an estimated time, or an estimated use ofcomputation resources, that is required for executing the query whosejoins are ordered in accordance with a join plan under consideration.Such use of time or resources may be minimized for an optimal join plan.All such optimization considerations may be summarized by a costfunction that is applied to the join plan. In this case, an optimal joinplan may be that generated join plan to which application of the costfunction yields a minimum cost value.

One of the join plans is selected for execution of the query (block160). For example, a selected join plan may be an optimal join plan asdetermined by the evaluation. The query that incorporates the selectedjoin plan may be returned by the query optimizer. The selected query maybe executed so as to obtain a query result.

In accordance with an example of query optimization using join orderrestrictions, a computer program application stored in acomputer-readable medium (e.g., register memory, processor cache, RAM,ROM, hard drive, flash memory, CD ROM, magnetic media, etc.) may includecode or executable instructions that when executed may instruct or causea controller or processor to perform methods discussed herein, such asan example of a method for query optimization using join orderrestrictions. The computer-readable medium may be a non-transitorycomputer-readable medium including all forms and types ofcomputer-readable media except for a transitory, propagating signal.

We claim:
 1. A method comprising: analyzing, by a processor of acomputing device, a query submitted to a database to determine a joinorder restriction that is associated with a join between two tables of aplurality of tables of the database that participate in the query, thejoin order restriction constraining its associated join to be executedprior to another join of the query, wherein analyzing the query todetermine the join order restriction comprises: determining a join orderthat produces a different result than a result obtained by executing thequery according to a join order semantically expressed in the query; andconstructing the join order restriction to exclude the determined joinorder that produces the different result, from join plans for executingthe query; assigning a ranking of priority to each join between tablesthat participate in the query based on the join order restriction,including assigning a join associated with the join order restriction alower priority than other joins in the query, wherein a join that wasassigned a higher priority is executed prior to a join that was assigneda lower priority; generating the join plans for executing the queryconstrained by the join order restriction, the join plans includingdifferent join orders; selecting a join plan from the join plans forexecution of the query; and executing, by the processor, the query basedon the selected join plan.
 2. The method of claim 1, wherein selectingthe join plan for execution of the query comprises evaluating anoptimization criterion for each join plan of the join plans.
 3. Themethod of claim 2, wherein the optimization criterion is related to anestimated execution time of the query that is executed in accordancewith the join plan or to an estimated quantity of a resource that isutilized by the query that is executed in accordance with the join plan.4. The method of claim 2, wherein the optimization criterion comprises acost value assigned to each join plan, and wherein the selected joinplan is the join plan whose assigned cost value is smallest.
 5. Themethod of claim 1, further comprising: representing the join orderrestriction by a plurality of ranks assigned to edges of a graph suchthat a join associated with a higher rank of the plurality of ranks isto be performed before a join associated with a relatively lower rank ofthe plurality of ranks.
 6. A non-transitory computer readable storagemedium storing instructions that when executed by a processor of acomputing device cause the processor to: obtain a query that issubmitted to a database, the query expressible as including a pluralityof joins, each join joining two tables of a plurality of tables of thedatabase that participate in the query; analyze the query to determine ajoin order restriction that is associated with a join of said pluralityof joins, the join order restriction constraining its associated join tobe executed prior to another join of said plurality of joins, wherein toanalyze the query to determine the join order restriction, the processoris to determine a join order that produces a different result than aresult obtained by executing the query according to a join ordersemantically expressed in the query, and construct the join orderrestriction to exclude the determined join order from join plans forexecuting the query; assign priority rankings to the plurality of joinsin the query, wherein to assign the priority rankings to the pluralityof joins in the query, the instructions are to cause the processor toassign the join associated with the join order restriction a lowerpriority ranking than other joins in the query; generate the join plansconstrained by the join order restriction and the priority rankings;select a join plan from the join plans for execution of the query; andexecute the query based on the selected join plan.
 7. The non-transitorycomputer readable storage medium of claim 6, wherein a join that wasassigned a higher priority ranking is executed prior to a join that wasassigned a lower priority ranking.
 8. The non-transitory computerreadable storage medium of claim 7, wherein the join plans are generatedwhen two of said plurality of joins are assigned equal priorities, suchthat those joins with the equal assigned priorities are executed in adifferent order in the join plans.
 9. The non-transitory computerreadable storage medium of claim 6, wherein to select the join plan, theinstructions are to cause the processor to evaluate comprises evaluationof an optimization criterion for each join plan of the join plans. 10.The non-transitory computer readable storage medium of claim 9, whereinthe optimization criterion for each join plan is related to an estimatedexecution time of the query in accordance with the join plan or to anestimated quantity of a resource that is utilized by the query that isexecuted in accordance with the join plan.
 11. The non-transitorycomputer readable storage medium of claim 9, wherein the evaluatedoptimization criterion for each join plan comprises a cost value that isassigned to that join plan and wherein the selected join plan is a joinplan whose assigned cost value is smallest.
 12. A system comprising: aprocessing unit; and a non-transitory computer readable medium storing aset of instructions that when executed by the processing unit cause theprocessing unit to: obtain a query submitted to a database; express thequery as a plurality of joins, each join joining two tables of aplurality of tables of the database that participate in the query;analyze the query to determine a join order restriction associated witha join of said plurality of joins, the join order restrictionconstraining its associated join to be executed prior to another join ofsaid plurality of joins, wherein to determine the join orderrestriction, the processing unit is to determine a join order thatproduces a different result than a result obtained by executing thequery according to a join order semantically expressed in the query, andconstruct the join order restriction to exclude the determined joinorder from join plans for execution of the query; assign a priorityranking to each join of said plurality of joins of the query, wherein toassign a priority ranking to each join, the set of instructions is tocause the processing unit to assign the join associated with the joinorder restriction a lower priority ranking than other joins in thequery; generate the join plans including different join ordersconstrained by the join order constraint and the priority rankings;select a join plan from the join plans based on an optimizationcriterion; and execute the query based on the selected join plan. 13.The system of claim 12, wherein a first join of the plurality of joinsassigned with a higher priority ranking is to be performed prior to asecond join of the plurality of joins assigned with a relatively lowerpriority ranking.
 14. The system of claim 12, wherein the set ofinstructions when executed by the processing unit cause the processingunit to represent the join order restriction by a plurality of ranksassigned to edges of a graph such that a join associated with a higherrank of the plurality of ranks is to be performed before a joinassociated with a relatively lower rank of the plurality of ranks. 15.The system of claim 12, wherein the optimization criterion comprises anestimated execution time of the query in accordance with each join planof the join plans.
 16. The system of claim 12, wherein the optimizationcriterion comprises an estimated quantity of a resource that is utilizedby a query that is executed in accordance with each join plan of thejoin plans.